package se.study.thread;

/**
 * @Author: tiger
 * @Date:2018/5/10
 * @Description:单纯的调用run()方法不会新开线程，相当于普通方法的调用
 */
public class TreadId {
    public static void main(String[] args) {
        System.out.println(Thread.currentThread().getId());

        Thread t = new Thread(() -> System.out.println("t线程编号：" + Thread.currentThread().getId()), "t线程");
        Thread t2 = new Thread(() -> System.out.println("t2线程编号：" + Thread.currentThread().getId()), "t2线程");

        new Runnable() {
            @Override
            public void run() {
                System.out.println("inner Runnable..." + Thread.currentThread().getId());
            }
        }.run();// run方法不会开启新的线程

        t.start();
        t2.start();

        System.out.println("===========");
        t2.run();// run方法不会开启新的线程
        System.out.println("===========");
    }
}
